/* 1684. 统计一致字符串的数目 */
/**
 * @param {string} allowed
 * @param {string[]} words
 * @return {number}
 */
var countConsistentStrings = function (allowed, words) {
	let ans = 0
	const set = new Set()
	for (const c of allowed) {
		set.add(c)
	}
	for (const word of words) {
		let flag = true
		for (let i = 0; i < word.length; i++) {
			// if (!~allowed.indexOf(word[i])) {
			// 	flag = false
			// 	break
			// }
			if (!set.has(word[i])) {
				flag = false
				break
			}
		}
		if (flag) {
			ans++
		}
	}
	return ans
}

countConsistentStrings('abc', ['a', 'b', 'c', 'ab', 'ac', 'bc', 'abc'])
